<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="org.limp.mine.StringTool"%>
<%@ page import="org.limp.mine.DateTrimmer"%>
<%@ page import="jt.classic.system.object.IObject"%>
<%@ page import="jt.classic.system.workflow.WObject"%>
<%@ page import="org.limp.basework.Table"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	IUser user = jt.classic.system.ISystem.getSessionUser(request);
	String groupId = user.igroup().id();
	String groupName = user.igroup().iname();
	String type = StringTool.checkString(request.getParameter("type"));

	IObject object = (IObject) request.getAttribute("object");
	WObject wobject = (WObject) request.getAttribute("wobject");
	Table tbl = object.iobject().itable("APP_QTF");
	Map info = (Map) ((List) object.icontent(tbl)).get(0);
	String HANDLELEVEL = StringTool.checkString(info.get("HANDLELEVEL"));
	String qtfid = StringTool.checkString(info.get("QTFID"));
    String label = "(街乡)";
	
	if(type.equals("1")){
		label = "(区)";
	}
%>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>群体访接访登记</TITLE>
<script type="text/javascript">
</script>
<jsp:include page="../../system/object/initial4edit.jsp"></jsp:include>

<link rel="stylesheet" type="text/css"
	href="<%=context%>/app/lf/css/xfstyle.css" />
<script src="<%=context %>/app/lf/js/xfinit.js"></script>

<script>

	var levelOneIds ;
	var levelOneNames ;
	var levelTwoIds  ;
	var levelTwoNames  ;
	var levelThreeIds  ;
	var levelThreeNames  ;
	var levelFourIds  ;
	var levelFourNames   ;
	var levelFiveIds  ;
	var levelFiveNames   ;
<%
         if(type.equals("1")){
     %>
     var url = context + '/system/objquery/commonlist.jsp?queryKey=qtfdjlist';
     <%
         }else{
     %>
     var url = context + '/system/objquery/commonlist.jsp?queryKey=qtfdjlist';
     <%
         }
     %>
     
     function handleSave(){
        	var l1 = document.getElementById("handleL_1");
        	var l2 = document.getElementById("handleL_2");
        	var l3 = document.getElementById("handleL_3");
        	var l4 = document.getElementById("handleL_4");
        	var l5 = document.getElementById("handleL_5");
        	if(l5.checked){
        	document.getElementById("HANDLELEVEL").value='5';
        	}else if(l4.checked){
        	document.getElementById("HANDLELEVEL").value='4';
        	}else if(l3.checked){
        	document.getElementById("HANDLELEVEL").value='3';
        	}else if(l2.checked){
        	document.getElementById("HANDLELEVEL").value='2';
        	}else if(l1.checked){
        	document.getElementById("HANDLELEVEL").value='1';
        	}
        	
         	handleSubmit(function(){
         	//在日志表中添加一条对接访单的修改记录
        	var url_log = context + '/app/xflog.do?method=insert';
			Ext.Ajax.request({
				url : url_log,
				params : {
					id :'<%=qtfid%>',
					opera : 'insert',
					type : '2',
					memo : "用户将处理等级修改 " +document.getElementById("HANDLELEVEL").value+ " 级"
				},
				method : 'POST',
				success : function(rs, request) {
				var respText = Ext.util.JSON.decode(rs.responseText); 
					if(respText.data != null){
					};
				},
				failure : function(rs, request) {
					Ext.Msg.alert('提示', '添加日志记录出现异常');
				}
			});
         	
         	
         	window.location.href = url;});
			
     }

     function init(){
         initLfdjStyle();
         editObject();
     }
     
     
     function levelClick(obj){
     	if(obj.checked){
     	
     	switch(obj.value){case "1":
     				document.getElementById("XBDWID").value = levelOneIds;
     				document.getElementById("XBDWNAME").value = levelOneNames;
     				//document.getElementById("cl2").style.display="none";
     				//document.getElementById("cl3").style.display="none";
     				//document.getElementById("cl4").style.display="none";
					break;
					case "2":
					document.getElementById("XBDWID").value = levelTwoIds;
     				document.getElementById("XBDWNAME").value = levelTwoNames;
     				//document.getElementById("cl2").style.display="block";
     				//document.getElementById("cl3").style.display="none";
     				//document.getElementById("cl4").style.display="none";
					break;
					case "3":
					document.getElementById("XBDWID").value = levelThreeIds;
     				document.getElementById("XBDWNAME").value = levelThreeNames;
     				//document.getElementById("cl2").style.display="block";
     				//document.getElementById("cl3").style.display="block";
     				//document.getElementById("cl4").style.display="none";
					break;
					case "4":
					document.getElementById("XBDWID").value = levelFourIds;
     				document.getElementById("XBDWNAME").value = levelFourNames;
     				//document.getElementById("cl2").style.display="block";
     				//document.getElementById("cl3").style.display="block";
     				//document.getElementById("cl4").style.display="block";
					break;
					case "5":
					document.getElementById("XBDWID").value = levelFiveIds;
     				document.getElementById("XBDWNAME").value = levelFiveNames;
					break;
					}
     	
     	}else{
     	
     	switch(obj.value){case "1":
     				document.getElementById("XBDWID").value = document.getElementById("XBDWID").value.replace(levelOneIds,'');
     				document.getElementById("XBDWNAME").value = document.getElementById("XBDWNAME").value.replace(levelOneNames,'');
					break;
					case "2":
					document.getElementById("XBDWID").value = document.getElementById("XBDWID").value.replace(levelTwoIds,'');
     				document.getElementById("XBDWNAME").value = document.getElementById("XBDWNAME").value.replace(levelTwoNames,'');
					break;
					case "3":
					document.getElementById("XBDWID").value = document.getElementById("XBDWID").value.replace(levelThreeIds,'');
     				document.getElementById("XBDWNAME").value = document.getElementById("XBDWNAME").value.replace(levelThreeNames,'');
					break;
					case "4":
					document.getElementById("XBDWID").value = document.getElementById("XBDWID").value.replace(levelFourIds,'');
     				document.getElementById("XBDWNAME").value = document.getElementById("XBDWNAME").value.replace(levelFourNames,'');
					break;
					case "5":
					document.getElementById("XBDWID").value = document.getElementById("XBDWID").value.replace(levelFiveIds,'');
     				document.getElementById("XBDWNAME").value = document.getElementById("XBDWNAME").value.replace(levelFiveNames,'');
					break;
					}
     	
     	}
     	
     	
     }
     
     
</script>
</HEAD>
<BODY style="background-color:#fff;" onload="javascript:init();">
<form id="form1" name="form1" method="post"
	enctype="multipart/form-data" action=""><input type="hidden"
	name="qtfid" value=""> <input type="hidden" name="DJRID"
	value="<%=user.id() %>"> <input type="hidden" name="LFTYPE"
	value="<%=type %>"> 
<table width="800" class="tab4edit" border="1" cellspacing="0"
	cellpadding="0" align="center">

	<tr>
		<td colspan="4" class="tdtlt">
		<div align="center"><!-- <%=label %> -->群体访接访登记</div>
		</td>
	</tr>
	<tr align="left" bgcolor="#FFFF99">
		<td colspan="4" valign="middle"><font color=red>带</font><font
			color="#003399">“</font><font color=red>*</font><font color="#003399">”</font><font
			color=red>的项目为必填项</font></td>
	</tr>

	<TR bgColor=#ffffff>
		<td align="right" valign="middle" class="td0" width="15%">内容分类 <FONT
			COLOR="#FF3366">*</FONT></td>
		<td align="left" colspan="3"><input type="text" name="NRNAME" id="NRNAME"
			value=""> <input type="hidden" name="NRID" id="NRID" value=""
			special="dataindex" wbtype="NRFL" wbname="NRNAME" colneed="1"
			label="内容分类" ></td>
	</TR>
	<tr>
		<td height="40" align="right" valign="middle" class="td0">来访性质</td>
		<td align="left" colspan="3"><input type="checkbox"
			name="LFXZID_0" value="1" />正常&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
			type="checkbox" name="LFXZID_1" value="1" />围堵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_2" value="1" />滞留&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_3" value="1" />闹事&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_4" value="1" />静坐&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_5" value="1" />重要访&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
		<input type="checkbox" name="LFXZID_6" value="1" />强制&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_7" value="1" />越级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_8" value="1" />不稳定因素&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_9" value="1" />包案后上访&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="checkbox" name="LFXZID_10" value="1" />未预报（20人以上）&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		</td>
	</tr>
	<tr align="right" valign="middle">
		<td class="td0">人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;数 <FONT
			COLOR="#FF3366">*</FONT></td>
		<td align="left" width="35%"><input type="text" name="RS" maxlength="5"
			size="4" value="" onkeyup="value=value.replace(/[^\d]/g,'');setJFT(this.value)"
			colneed="1" label="人数" /> 人 <input type="hidden" name="JTF" id="JTF"/></td>
		<td class="td0">所 属 社 区 <FONT COLOR="#FF3366">*</FONT></td>
		<td align="left" width="35%"><input type="text" name="SSDNAME" value="">
		<input type="hidden" name="SSD" value="" special="dataindex"
			wbtype="SSD" wbname="SSDNAME"  ssdcode="<%=user.igroup().iarea() %>" colneed="1" label="所属地"></td>
	</tr>
	<tr align="right" valign="middle" style="display:none">
		<td class="td0">登 记 人 <FONT COLOR="#FF3366">*</FONT></td>
		<td align="left"><%=user.iname()%> <input type="hidden"
			name="DJRID" value="<%=user.id() %>"> <input type="hidden"
			name="DJRNAME" value="<%=user.iname() %>"></td>
		<td class="td0"></td>
		<td align="left" colspan="3"><input name="XFTIME" size="15"
			value="<%=DateTrimmer.getYMD() %>" type="hidden"/></td>
	</tr>

	<tr align="right" valign="middle">
		<td class="td0">内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容 <FONT
			COLOR="#FF3366">*</FONT></td>
		<td colspan="3" align="left"><textarea name="NR" cols="80"
			rows="5" colneed="1" label="内容"></textarea></td>
	</tr>
	<tr align="right" valign="middle" id="lingdao1">
		<td align="right" valign="middle" class="td0">接访部门</td>
		<td align="left"><input type="hidden" name="JFDWID" id="JFDWID" value="<%=groupId %>"> <input
			type="text" readonly="true" name="JFDWNAME" value="<%=groupName %>"></td>
		<td class="td0">处理等级<input type="hidden" name="HANDLELEVEL" id="HANDLELEVEL"> </td>
		<td align="left"><input type="radio" name="handleL" id="handleL_1" value="1" onclick="levelClick(this)"/>一级&nbsp;
		<input type="radio" name="handleL" id="handleL_2" value="2"  onclick="levelClick(this)"/>二级&nbsp;
		<input type="radio" name="handleL" id="handleL_3" value="3"  onclick="levelClick(this)"/>三级&nbsp;
		<input type="radio" name="handleL" id="handleL_4" value="4"  onclick="levelClick(this)"/>四级&nbsp;
		<input type="radio" name="handleL" id="handleL_5" value="5"  onclick="levelClick(this)"/><font color="red">五级</font>&nbsp;
		</td>
	</tr>
	
	<tr align="right" valign="middle">
		<td class="td0">协调部门 <FONT COLOR="#FF3366">*</FONT></td>
		<td colspan="3" align="left">
		<input type="hidden" name="XBDWID" id="XBDWID" value="">
		<textarea name="XBDWNAME"  id="XBDWNAME"  cols="80"
			rows="3" colneed="1" label="协调部门"></textarea> 
		</td>
	</tr>
	<tr align="left" valign="middle">
		<td class="td0" align="right" >协调部门是否需要填写办理意见</td>
		<!-- <td  colspan="3">是<input type="radio" id="XFXYHF1" name="XFXYHF" value="1" />&nbsp;否<input type="radio" id="XFXYHF0"  name="XFXYHF" value="0" /></td>-->
		<td  colspan="3">是<input type="radio" id="XFXYHF0" name="XFXYHF" value="0" />&nbsp;否<input type="radio" id="XFXYHF1"  name="XFXYHF" value="1" /></td>
	</tr>
	<tr align="right" valign="middle">
		<td class="td0">处理结果</td>
		<td colspan="3" align="left"><textarea name="CLFS" cols="80"
			rows="3" colneed="1" label="处理方式"></textarea></td>
	</tr>
	<!-- 
	<tr align="right" valign="middle"  id="cl2" style="display:none">
		<td class="td0">二级接访<br>处理建议</td>
		<td colspan="3" align="left"><textarea name="CLFS2" cols="80"
			rows="3" ></textarea> </td>
	</tr>
	<tr align="right" valign="middle" id="cl3" style="display:none">
		<td class="td0">三级接访<br>处理建议</td>
		<td colspan="3" align="left"><textarea name="CLFS3" cols="80"
			rows="3" ></textarea> </td>
	</tr>
	<tr align="right" valign="middle" id="cl4" style="display:none">
		<td class="td0">四级接访<br>处理建议</td>
		<td colspan="3" align="left"><textarea name="CLFS4" cols="80"
			rows="3" ></textarea> </td>
	</tr>
	 -->
	<tr align="right" valign="middle">
		<td class="td0">图像附件</td>
		<td colspan="3" align="left"><input type="file" name="PIC"
			id="PIC" />&nbsp;&nbsp;(文件大小不能超过10M,文件类型为“.doc,.xls,.txt,.jpg,.gif,.bmp,.pdf”)<BR>
		</td>
	</tr>

	<tr align="right" valign="middle">
		<td class="td0">视频附件</td>
		<td colspan="3" align="left"><input type="file" name="VIDEO"
			id="VIDEO" />&nbsp;&nbsp;(文件大小不能超过10M,文件类型为“.doc,.xls,.txt,.jpg,.gif,.bmp,.pdf”)<BR>
		</td>
	</tr>
</table>

<table width="100%">
	<tr>
		<td align="center"><input type="button" name="btn0" class="button0" value=" 提交 "
			onclick="javascript:handleSave();">
		<input type="button" name="btn1" class="button0" value=" 返 回 " onclick="javascript:window.history.back(-1);">
	   </td>
	</tr>
</table>
</form>
<script>

var NRID = document.getElementById("NRID");
var HANDLELEVEL = "<%=HANDLELEVEL%>";

switch(HANDLELEVEL){case "1":
     				document.getElementById("handleL_1").checked=true;
     				//document.getElementById("handleL_2").disabled = false;
					break;
					case "2":
					//document.getElementById("cl2").style.display = "block";
     				document.getElementById("handleL_2").checked=true;
     				//document.getElementById("handleL_3").disabled = false;
					break;
					case "3":
					//document.getElementById("cl2").style.display = "block";
					//document.getElementById("cl3").style.display = "block";
     				document.getElementById("handleL_3").checked=true;
     				//document.getElementById("handleL_4").disabled = false;
					break;
					case "4":
					//document.getElementById("cl2").style.display = "block";
					//document.getElementById("cl3").style.display = "block";
					//document.getElementById("cl4").style.display = "block";
     				document.getElementById("handleL_4").checked=true;
					break;
					case "5":
     				document.getElementById("handleL_5").checked=true;
					break;
					}


function sendRequestPost(){

	var url = context + '/app/xtbm.do?method=getXtbm';

	Ext.Ajax.request({
				url : url,
				params : {
					id : NRID.value
				},
				method : 'POST',
				success : function(rs, request) {
				var respText = Ext.util.JSON.decode(rs.responseText); 
					if(respText.data != null){
					levelOneIds = respText.data.JX_LEVEL1_ID;
					levelOneNames = respText.data.JX_LEVEL1_NAME;
					levelTwoIds = respText.data.JX_LEVEL2_BX_ID+","+respText.data.JX_LEVEL2_TX_ID;
					levelTwoNames = respText.data.JX_LEVEL2_BX_NAME+","+respText.data.JX_LEVEL2_TX_NAME;
					levelThreeIds = respText.data.JX_LEVEL3_BX_ID+","+respText.data.JX_LEVEL3_TX_ID;
					levelThreeNames = respText.data.JX_LEVEL3_BX_NAME+","+respText.data.JX_LEVEL3_TX_NAME;
					levelFourIds = respText.data.JX_LEVEL4_BX_ID+","+respText.data.JX_LEVEL4_TX_ID;
					levelFourNames = respText.data.JX_LEVEL4_BX_NAME+","+respText.data.JX_LEVEL4_TX_NAME;
					levelFiveIds = respText.data.JX_LEVEL5_BX_ID+","+respText.data.JX_LEVEL5_TX_ID;
					levelFiveNames = respText.data.JX_LEVEL5_BX_NAME+","+respText.data.JX_LEVEL5_TX_NAME;			
					};
					  
					
				},
				failure : function(rs, request) {
					Ext.Msg.alert('提示', '出现异常');
				}
			});


}


// 如果是FF
if (NRID.addEventListener) {
	NRID.addEventListener('onpropertychange', sendRequestPost, false);
}
// 如果是IE
else if (NRID.attachEvent) {
	NRID.attachEvent('onpropertychange', sendRequestPost);
} else {
	NRID['onpropertychange'] = sendRequestPost;
}

</script>
</BODY>
</HTML>
